package com.demo.client.test;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Main {
    public static void main(String[] args) {
//        ConcreteSubject subject = new ConcreteSubject();
//
//        Observer observer1 = new ConcreteObserver("Observer1");
//        Observer observer2 = new ConcreteObserver("Observer2");
//        Observer observer3 = new ConcreteObserver("Observer3");
//
//        subject.addObserver(observer1);
//        subject.addObserver(observer2);
//        subject.addObserver(observer3);
//
//        subject.setState("New State");

        //  观察者模式

        User user1 = new User("张三");
        User user2 = new User("王二");
        User user3 = new User("李四");
        SendMsg send = new SendMsg();
        send.addUser(user1);
        send.addUser(user2);
        send.addUser(user3);
        send.sendNotice("新消息：");


        ExecutorService fixedThreadPool = Executors.newFixedThreadPool(5);
        fixedThreadPool.shutdown();

        // 使用线程池...

        // 关闭线程池
        fixedThreadPool.shutdown();
    }
}
